<template>
  <div class="transitContainer">

    <!--未授权-->
    <div class="page-auth">
      <div class="title-box">
        <div class="logo">
          <img :src="require('@/static/image/logo.png')" class="logo" alt="">
        </div>
        <div class="name">建安三类联系平台</div>
        <div class="text">申请获得</div>
      </div>
      <div class="desc">以下权限</div>
      <div class="sub-desc">
        <icon name="passed" />
        <div class="sub-text">获取您的微信头像和昵称</div>
      </div>
      <div class="middle">
        <button type="primary" @click="handleGAuthClick" class="btn-agree">同意</button>
      </div>
    </div>

  </div>
</template>
<script>

export default {
  name: 'auth',
  data() {
    return {
      appid:"wx9cf55b2a5597aa92",
      local:"http://ksphone.78787878.club",//域名
      openId:'',
      code:'',
    }
  },

  created(){
    const openid = localStorage.getItem("openid");
    if(openid){
      //跳转中转页面,并携带中转页面所需参数
      uni.redirectTo({
        url:"/pages/exam/login"
      })
    }
  },

  methods:{
    /**
     * 授权按钮点击事件
     */
    handleGAuthClick(){
      window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + this.appid + "&redirect_uri=" + encodeURIComponent(this.local) + "&response_type=code&scope=snsapi_userinfo&state=STATE"
    },
  },

  mounted() {
  },


  destroyed(){
  },

}
</script>
<style lang="scss" scoped>
uni-button {
  font-size: 26rpx;
}
.transitContainer {
  width: 100vw;
  height: 100vh;
  background-color: white;
  display: flex;
  justify-content: center;
  align-items: center;

  .page-auth{
    width: 100vw;
    height: 100vh;
    padding: 40rpx;
    box-sizing: border-box;
    .title-box{
      display: flex;
      justify-content: flex-start;
      align-items: center;
      font-size: 30rpx;
      color: #313131;
      .logo{
        width: 120rpx;
        height: 120rpx;
        border-radius: 50%;
      }
      .text{
        font-size: 32rpx;
        margin-left: 20rpx;
      }
    }
    .middle{
      justify-content: center;
      display: flex;
    }
    .desc{
      margin-top: 60rpx;
      font-size: 40rpx;
      color: #313131;
      font-weight: bold;
    }
    .sub-desc{
      display: flex;
      justify-content: flex-start;
      align-items: center;
      margin-top: 60rpx;
      font-size: 30rpx;
      color: #313131;
      .sub-text{
        margin-left: 30rpx;
      }
    }
    .btn-agree{
      width: 240rpx;
      height: 72rpx;
      margin: 360rpx auto;
      border-radius: 8rpx;
    }
  }
}
</style>
